import sys
# sys.path.append('../../')

import os
import pandas as pd
import numpy as np

import time


from models.parts import Parts
for root,p,files in os.walk('/Users/carl/Desktop/test'):
    item = []
    for fi in files:
        fi ='/'.join([root,fi])
        if fi.endswith('xlsx'):
            print(fi)
            df = pd.read_excel(fi)
            df.fillna('', inplace=True)
            for index, row in df.iterrows():
                if row.to_dict()['OE编号'] or row.to_dict()['有道件号']:
                    print(type(row))
                    print(row)
                    print(type(row.to_dict()))
                    print('to_dict:--{}'.format(row.to_dict()), end='')
                    print(row.to_dict()['有道件号'])
                    print(type(row.to_dict()['OE编号']))
                    print('get:--{}'.format(row.get('OE编号')), end='')
                    print(row.get('有道件号'))
                    print(type(row.get('OE编号')))
                    break
                    item.append({'OE号':row.get('OE编号'),'产品编码':row.get('有道件号')})
    df2 = pd.DataFrame(item)
    df2.to_excel('/Users/carl/Desktop/test.xlsx',index=False)